-
Notifications
You must be signed in to change notification settings - Fork 15
Add INCIDENT_RESTART event #1504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1504 +/- ##
=======================================
Coverage 79.46% 79.46%
=======================================
Files 121 121
Lines 5409 5410 +1
=======================================
+ Hits 4298 4299 +1
Misses 1111 1111 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Only thing im unsure of is the migration generated seems to be duplicating changes? It seems to be converting the id of some fields to BigAutoField despite that already being in the previous squashed migration? I cant imagine it would cause any issues but not really sure whats going on with that. |
Code looks good to me :) That migration is a bit strange yeah, maybe @hmpf can shed some light on what's happening there Can you add one or more tests?
|
Agree about the migrations, the change to BigAutoField should already have happened . On Tuesday I hope to be able to check this properly. Do You should have this line (first column may be different, last column deffo different)
If not in prod db I'll see if I can do some experiments (with your help) next week, we might need a release that canonicalizes the squashed migrations (=deletes the old ones, needs manual rewrite of the new migrations). If not in dev: nuke the dev database and migrate to version 1.37.0 and check again before you migrate to 2.0.0. Also do
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also like to see a test for restarting an ended incident and then ending it again.
This should simply post the event without changing anything about the incident itself. |
Ok so have investigated this some more and it actually seems to be a small issue with the squashed migration. Firstly if I just checkout to master with a blank db and make migrations it makes the same changes for the ID's (except what I added of course), i assume there should be no detected changes. What I think has happened is that originally the ID fields were being autocreated (not defined in model) but then explicitly defined as bigints in 10bc007. So in migration 0001_initial it does
to
in the squashed migration stops makemigrations from detecting changes. |
1af8625
to
6b649a9
Compare
Ok have now
Let me know if you want more tests/changes to what I made, |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some nitpicks about naming/function parameters
reopen_event_dict = self._create_event_dict(Event.Type.INCIDENT_RESTART) | ||
response = self.source1_rest_client.post(self.events_url(self.stateful_incident1), reopen_event_dict) | ||
self.assertEqual(parse_datetime(response.data["timestamp"]), reopen_event_dict["timestamp"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reopen_event_dict = self._create_event_dict(Event.Type.INCIDENT_RESTART) | |
response = self.source1_rest_client.post(self.events_url(self.stateful_incident1), reopen_event_dict) | |
self.assertEqual(parse_datetime(response.data["timestamp"]), reopen_event_dict["timestamp"]) | |
restart_event_dict = self._create_event_dict(Event.Type.INCIDENT_RESTART) | |
response = self.source1_rest_client.post(self.events_url(self.stateful_incident1), restart_event_dict) | |
self.assertEqual(parse_datetime(response.data["timestamp"]), restart_event_dict["timestamp"]) |
self.assertTrue(self.stateful_incident1.events.filter(pk=response.data["pk"]).exists()) | ||
self.assertEqual(response.data["incident"], self.stateful_incident1.pk) | ||
|
||
def _assert_incident_is_closed_at_timestamp(self, end_event_timestamp): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be cleaner to have the incident as a parameter as well instead of assuming it is self.stateful_incident1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Scope and purpose
Fixes #1502.
Depends on #1506.
Adds a new INCIDENT_RESTART event to allow source systems to reopen incidents.
Described further in linked issue.
This pull request
Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to Argus can be found in the
Development docs.
Added a changelog fragment for towncrier
Added/amended tests for new/changed code
Doesn't break any tests, doesn't introduce any untested lines of code, and is implemented in the same way as the existing REOPEN event. So adding/changing tests didn't seem necessary, happy to do otherwise if needed.Added/changed documentation, including updates to the user manual if feature flow or UI is considerably changed
Linted/formatted the code with ruff and djLint, easiest by using pre-commit
The first line of the commit message continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See our how-to
If this results in changes to the database model:
Updated the ER diagramThere are no changes to the ER diagram as a result of adding a new event type